#!/usr/bin/perl -w

$subID = "$ARGV[0]";     # Service label id
$pageID = "$ARGV[1]";   # section name
$value = "Error: Label not found!";   # initializing value

open $file, "<", "ServiceLabel.txt" or $value = "Error: ServiceLabel.txt not found!";

if ($value =~ "Error: Label not found!") {

while ($line = <$file>) {   # checks all lines in file

   if($line =~ /^\s*\#+/){}
        elsif($line =~ 
        /$pageID.*\|
	\s*$subID\s*=\s*
        (\"(.+)\"|
        \'(.+)\')
	\s*(\#.*)?$/x) 
	{
		if($2) { $value = $2; }
		if($3) { $value = $3; }
	}
}
}

$value =~ s/\"/\\\"/g;
$value =~ s/\'/\\\'/g;

print $value."\n";

close $file;

exit(5);

